//
//  WJNavigationController.swift
//  WJWEIBO
//
//  Created by 文杰 许                       on 2017/5/8.
//  Copyright © 2017年 文杰 许                      . All rights reserved.
//

import UIKit

class WJNavigationController: UINavigationController {
    
    override func viewDidLoad()
    {
        super.viewDidLoad()
        
        navigationBar.isHidden = true
    }

    /// 重写push方法
    override func pushViewController(_ viewController: UIViewController, animated: Bool)
    {
        
        if childViewControllers.count > 0
        {
            viewController.hidesBottomBarWhenPushed = true
            
            if let vc = viewController as? WJBaseViewController
            {
                var title = "返回"
                
                if childViewControllers.count == 1
                {
                    title = childViewControllers.first?.title ?? "返回"
                }
                
                vc.backBarItem .setTitle(title, for: .normal)
            }
        }
        
        super.pushViewController(viewController, animated: true)

    }
    
    
}


